Repository navigation
Conversation
Port of the AdjointAmericanEquityOption C++ example. Prices an American put with the finite-difference Black-Scholes engine (801 time steps) and computes rho, strike sensitivity, vega, delta, and dividend rho in a single adjoint pass. The example cross-checks the Greeks against bump-and-reprice finite differences and documents the one mismatch: the FD engine builds its operator from the dividend yield as a plain value, so the adjoint dividend rho is numerically zero while bumping gives about 9.05. The other four Greeks agree to within 6e-5 relative.
|
|
Contributor
|
@tylrcc friendly reminder: the CLA (link in the bot comment above) is the only thing holding these four PRs. It takes a minute to sign, and then we can get CI going and review them. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16.
Python port of the
AdjointAmericanEquityOptionC++ example, following the pattern ofswap-adjoint.py:FdBlackScholesVanillaEngine(801 time steps, 800 grid points).Testing: the current
QuantLibAADwheel is not reachable from my sandbox, so I ran the identical example code against QuantLib-Risks 1.33.3 (the direct predecessor of QuantLibAAD; only the tape-construction lines differ between the two APIs). It runs end to end: value 4.4861132726; rho adjoint -10.342487 vs bump -10.341887; strike 0.739227 vs 0.739227; vega 10.936834 vs 10.937061; delta -0.696749 vs -0.696749.One known mismatch, documented in the example itself: the FD engine builds its operator from the dividend yield as a plain value, so the adjoint dividend rho comes out numerically zero (0.000031) while bumping gives 9.046635. I verified this is specific to the FD engine, not the port: the analytic engine and Barone-Adesi-Whaley both produce dividend rhos that match bumping on the same setup, and the FD engine shows the same behaviour for a European option. The C++ example has the same property, since it uses the same engine. Flagging it here in case you would rather the example note be worded differently.
Note: this repo requires a signed CLA before merge (per CONTRIBUTING) — I understand it will be handled through the CLA flow.